package com.maoxx.humanresourcemanage_service.controller;

import com.maoxx.humanresourcemanage_service.dto.ResponseDTO;
import com.maoxx.humanresourcemanage_service.entity.Staff;
import com.maoxx.humanresourcemanage_service.service.LoginService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @className: LoginController
 * @author: Maoxx
 * @date: 2024/11/6 16:40
 * @Version: 1.0
 * @description:
 */

@RestController
public class LoginController {
    @Resource
    private LoginService loginService;


    /**
     * 处理用户登录请求的方法
     *
     * @param staff 包含登录信息的Staff对象，包括用户名和密码等
     * @return 登录结果，以ResponseDTO对象的形式返回，包含登录是否成功以及相关的提示信息
     */
    @PostMapping("/login")
    public ResponseDTO login(@RequestBody Staff staff) {
        return loginService.login(staff);
    }
}
